#include <iostream>
#include <cstring>
using namespace std;
template <class T>
class vector
{
    using iterator = T *;
    using const_iterator = const T *const;

public:
    // 构造函数
    vector() {}

    // 扩容
    void reserve(size_t n)
    {
        if (n > capcity())
        {
            T *_data = new T[n];
            size_t cap = capcity();
            if (cap > 0)
            {
                memcpy(_data, _start, cap * sizeof(T));
            }
            else
            {
                _start = _data;
            }
        }
    }

    bool empty()
    {
        return _start == _end;
    }

    // 测试当都为nullptr
    size_t capcity()
    {
        return _storage - _start;
    }

    size_t size()
    {
        return _end - _start;
    }

private:
    iterator _start = nullptr;
    iterator _end = nullptr;
    iterator _storage = nullptr;
};
int main()
{
    // alignas(8) char buf[] = "01234567";  // 8 字节，对齐到 8
    // std::cout << "before: " << buf << '\n';

    // /* 高→低，仅 6 字节，够短，glibc 不会开 SIMD，必炸 */
    // std::memcpy(buf + 2, buf, 6);

    // std::cout << "memcpy: " << buf << '\n';
    vector<int> v;
    cout << v.capcity() << endl;
    cout << v.size() << endl;
    return 0;
}